-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vmConfig check for invalid tracer. #27002
Conversation
I think we can do it in an alternative approach. We can remove the Debug field in // Config are the configuration options for the Interpreter
type Config struct {
// Debug bool // Enables debugging
Tracer EVMLogger // Opcode logger
NoBaseFee bool // Forces the EIP-1559 baseFee to 0 (needed for 0 price calls)
EnablePreimageRecording bool // Enables recording of SHA3/keccak preimages
ExtraEips []int // Additional EIPS that are to be enabled
}
// Tracing returns an indicator if evm execution tracer is configured.
func (config *Config) Tracing() bool {
return config.Tracer != nil
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we could just disable Debug
and print a warning, but OTOH this is a situation where you probably would rather abort and retry than continue and see a warning.
I'm fine with this. The solution from @rjl493456442 is "not great" IMO, because the Debug
check happens in a lot ot hot-spots, where we don't want to incur a method call.
If we switched to use proper constructor-invocations, then it would be easier to solve it by having the Debug flag become set implicitly rather than explicitly.
TLDR; SGTM for now
I'm slightly in favor of dropping It seems so far tracer is the only use-case for |
Ok, I'm fine with @rjl493456442 's idea, but then we need to turn it into a local variable in the interpreter loop |
Implemented in #27048, PTAL |
Closing in favour of #27048 |
When we create a new blockchain we supply a vmConfig object. If we set debug mode to true without supplying aTracer we have the following nil pointer deref.
go-ethereum/core/state_transition.go
Line 328 in 7ca4f60
If we specify debug without adding a tracer we will get the nil pointer deref here. To mitigate this the constructor for blockchain checks that if the vmConfig has debug mode enabled it also checks to make sure the tracer is non-nil.